#ifndef HPTOOLS_H
#define HPTOOLS_H

#include <QtCore>
#include <QtGui>
#include "QDebug"
#include "assert.h"

#include "quazip/quazip.h"
#include "quazip/quazipfile.h"

#define HP_AUTOLOG() do{ qDebug() << "AUTOLOG" << __FILE__ << __FUNCTION__ << __LINE__ ; } while(0)




enum PenType
{
    PENCIL = 0,
    FELTTIP,
    MECHANICAL_PENCIL
};

class PenInfo
{
public:
    PenType type;
    int size;
    QColor color;

    int toRobotTool();
    QString toRobotColor();


private:
    friend QDataStream & operator << (QDataStream &, const PenInfo &);
    friend QDataStream & operator >> (QDataStream &, PenInfo &);
};

inline
bool operator== (const PenInfo &a, const PenInfo &b)
{
    return  a.type == b.type
            && a.size == b.size
            && a.color == b.color ;
}
inline
bool operator!= (const PenInfo &a, const PenInfo &b)
{
    return !(a==b);
}


Q_DECLARE_METATYPE(PenInfo)

QDataStream &operator<<(QDataStream &out, const PenInfo &penInfo);
QDataStream& operator >>( QDataStream &in, PenInfo& penInfo );


bool zip(const QString & filePath, const QDir & dir, const QString & comment = QString(""));
bool unzip(const QString & filePath, const QString & extDirPath, const QString & singleFileName = QString(""));


QImage grayscaled(const QImage &image);
// Tint an image with the specified color and return it as a new image
QImage tinted(const QImage &image, const QColor &color);

void tint( QAbstractButton* _pButton, QColor _color );
QPixmap tinted( const QPixmap& _rPixmap, QColor _color);

#endif // HPTOOLS_H
